package Levels 
{
	import Objetos.Heroi;
	import Objetos.Plataforma;
	/**
	 * ...
	 * @author Rodrigo Forti
	 */
	public class Level1 extends Level
	{
		private var IN_delayUpgrade:int
		
		public function Level1() 
		{
			IN_delayUpgrade = 300;
			AR_posicoesUpgrade = [[100, 60], [430, 340], [650, 200]];
		}
		
		public function desenharTela():void
		{
			_gameConstructor = new Fase1();
			Main.getInstance().MC_tela.addChild(_gameConstructor);
			
			Main.getInstance().MC_tela.addChild(TX_placar);
			
			MC_heroiA = new Heroi(1);
			MC_heroiA.x = 100;
			MC_heroiA.y = 100;
			Main.getInstance().MC_tela.addChild(MC_heroiA);
			Level.AR_herois.push(MC_heroiA);
			
			MC_heroiA = new Heroi(2);
			MC_heroiA.x = 200;
			MC_heroiA.y = 250;
			Main.getInstance().MC_tela.addChild(MC_heroiA);
			Level.AR_herois.push(MC_heroiA);
		}
		
		public function desenharArray():void
		{
			for (var m:uint = 0; m < _gameConstructor.numChildren; m++)
			{
				var mc:Object = _gameConstructor.getChildAt(m);
				
				if (mc is Plataforma)
				{
					AR_plataforma.push(mc);
				}
			}
			
		}
		
		public override function update():void
		{	
			super.update();
			if (MC_upgrade == null)
			{
				IN_delayUpgrade--;
			}
			
			if (IN_delayUpgrade == 0)
			{
				UI_randomPosicao = Math.random() * 3;
				MC_upgrade = new Upgrade();
				MC_upgrade.x = AR_posicoesUpgrade[UI_randomPosicao][0];
				MC_upgrade.y = AR_posicoesUpgrade[UI_randomPosicao][1];
				Main.getInstance().MC_tela.addChild(MC_upgrade);
				IN_delayUpgrade = 300;
			}
		}
		
	}

}